Dynomotion

Group: DynoMotion Message: 2896 From: himykabibble Date: 1/2/2012
Subject: Connection Management....
I'm finding connection management rather bothersome. I've modified my constructor so it creates the KM_Controller object, then, every 100 mSec I call a method that compares the current Connected state to the previous (100 mSec ago). If it WAS disconnected, and IS now connected, then I re-initalize everything (creating new Axis and IO dictionaries), then download my Init.c. But, I'm finding I get frequent errors when the board comes or goes. Sometimes I'll get an error from a ReadDigitalIO call, complaining about a null reference, or an exception from within KMIO due to an invalid return value. And, of course, I've had to litter my code with "if (KMController.Connected)", so I don't try to talk to a board that isn't there.

Can I get some pointers on how to correctly handle this, so I handle connection state changes cleanly?

Regards,
Ray L.
Group: DynoMotion Message: 2901 From: bradodarb Date: 1/2/2012
Subject: Re: Connection Management....
Hello Ray,

I would just call the init on reconnect, there should no need to reinit everything.

-Brad Murry

--- In DynoMotion@yahoogroups.com, "himykabibble" <jagboy@...> wrote:
>
> I'm finding connection management rather bothersome. I've modified my constructor so it creates the KM_Controller object, then, every 100 mSec I call a method that compares the current Connected state to the previous (100 mSec ago). If it WAS disconnected, and IS now connected, then I re-initalize everything (creating new Axis and IO dictionaries), then download my Init.c. But, I'm finding I get frequent errors when the board comes or goes. Sometimes I'll get an error from a ReadDigitalIO call, complaining about a null reference, or an exception from within KMIO due to an invalid return value. And, of course, I've had to litter my code with "if (KMController.Connected)", so I don't try to talk to a board that isn't there.
>
> Can I get some pointers on how to correctly handle this, so I handle connection state changes cleanly?
>
> Regards,
> Ray L.
>
Group: DynoMotion Message: 2902 From: himykabibble Date: 1/2/2012
Subject: Re: Connection Management....
Brad,

If I try to do a full init with no board connected, I get tons of exceptions when doing the axis and IO setup, which is why it seemed to me I HAD to have the board present to do that.

Regards,
Ray L.

--- In DynoMotion@yahoogroups.com, "bradodarb" <bradodarb@...> wrote:
>
> Hello Ray,
>
> I would just call the init on reconnect, there should no need to reinit everything.
>
> -Brad Murry
>
> --- In DynoMotion@yahoogroups.com, "himykabibble" <jagboy@> wrote:
> >
> > I'm finding connection management rather bothersome. I've modified my constructor so it creates the KM_Controller object, then, every 100 mSec I call a method that compares the current Connected state to the previous (100 mSec ago). If it WAS disconnected, and IS now connected, then I re-initalize everything (creating new Axis and IO dictionaries), then download my Init.c. But, I'm finding I get frequent errors when the board comes or goes. Sometimes I'll get an error from a ReadDigitalIO call, complaining about a null reference, or an exception from within KMIO due to an invalid return value. And, of course, I've had to litter my code with "if (KMController.Connected)", so I don't try to talk to a board that isn't there.
> >
> > Can I get some pointers on how to correctly handle this, so I handle connection state changes cleanly?
> >
> > Regards,
> > Ray L.
> >
>
Group: DynoMotion Message: 2903 From: Brad Murry Date: 1/2/2012
Subject: Re: Connection Management....

Hello Ray,

 

I must have been unclear, sorry about that.

 

What I meant was do everything you are doing(monitoring connection, etc…) but when you reach the point of detecting a loss of connection and then a reconnect just call your init files and that’s it.

 

-Brad Murry

 

From: DynoMotion@yahoogroups.com [mailto:DynoMotion@yahoogroups.com] On Behalf Of himykabibble
Sent: Monday, January 02, 2012 9:21 PM
To: DynoMotion@yahoogroups.com
Subject: [DynoMotion] Re: Connection Management....

 

 

Brad,

If I try to do a full init with no board connected, I get tons of exceptions when doing the axis and IO setup, which is why it seemed to me I HAD to have the board present to do that.

Regards,
Ray L.

--- In DynoMotion@yahoogroups.com, "bradodarb" <bradodarb@...> wrote:
>
> Hello Ray,
>
> I would just call the init on reconnect, there should no need to reinit everything.
>
> -Brad Murry
>
> --- In DynoMotion@yahoogroups.com, "himykabibble" <jagboy@> wrote:
> >
> > I'm finding connection management rather bothersome. I've modified my constructor so it creates the KM_Controller object, then, every 100 mSec I call a method that compares the current Connected state to the previous (100 mSec ago). If it WAS disconnected, and IS now connected, then I re-initalize everything (creating new Axis and IO dictionaries), then download my Init.c. But, I'm finding I get frequent errors when the board comes or goes. Sometimes I'll get an error from a ReadDigitalIO call, complaining about a null reference, or an exception from within KMIO due to an invalid return value. And, of course, I've had to litter my code with "if (KMController.Connected)", so I don't try to talk to a board that isn't there.
> >
> > Can I get some pointers on how to correctly handle this, so I handle connection state changes cleanly?
> >
> > Regards,
> > Ray L.
> >
>

Group: DynoMotion Message: 2904 From: himykabibble Date: 1/2/2012
Subject: Re: Connection Management....
Brad,

So, if I'm understanding correctly.... The Axis and IO setup can be done once, but must be done WHEN connected. But subsequent re-connects can simple download the Init.c, and that's it?

Regards,
Ray L.

--- In DynoMotion@yahoogroups.com, Brad Murry <bradodarb@...> wrote:
>
> Hello Ray,
>
>
>
> I must have been unclear, sorry about that.
>
>
>
> What I meant was do everything you are doing(monitoring connection, etc.)
> but when you reach the point of detecting a loss of connection and then a
> reconnect just call your init files and that's it.
>
>
>
> -Brad Murry
>
>
>
> From: DynoMotion@yahoogroups.com [mailto:DynoMotion@yahoogroups.com] On
> Behalf Of himykabibble
> Sent: Monday, January 02, 2012 9:21 PM
> To: DynoMotion@yahoogroups.com
> Subject: [DynoMotion] Re: Connection Management....
>
>
>
>
>
> Brad,
>
> If I try to do a full init with no board connected, I get tons of exceptions
> when doing the axis and IO setup, which is why it seemed to me I HAD to have
> the board present to do that.
>
> Regards,
> Ray L.
>
> --- In DynoMotion@yahoogroups.com <mailto:DynoMotion%40yahoogroups.com> ,
> "bradodarb" <bradodarb@> wrote:
> >
> > Hello Ray,
> >
> > I would just call the init on reconnect, there should no need to reinit
> everything.
> >
> > -Brad Murry
> >
> > --- In DynoMotion@yahoogroups.com <mailto:DynoMotion%40yahoogroups.com> ,
> "himykabibble" <jagboy@> wrote:
> > >
> > > I'm finding connection management rather bothersome. I've modified my
> constructor so it creates the KM_Controller object, then, every 100 mSec I
> call a method that compares the current Connected state to the previous (100
> mSec ago). If it WAS disconnected, and IS now connected, then I re-initalize
> everything (creating new Axis and IO dictionaries), then download my Init.c.
> But, I'm finding I get frequent errors when the board comes or goes.
> Sometimes I'll get an error from a ReadDigitalIO call, complaining about a
> null reference, or an exception from within KMIO due to an invalid return
> value. And, of course, I've had to litter my code with "if
> (KMController.Connected)", so I don't try to talk to a board that isn't
> there.
> > >
> > > Can I get some pointers on how to correctly handle this, so I handle
> connection state changes cleanly?
> > >
> > > Regards,
> > > Ray L.
> > >
> >
>
Group: DynoMotion Message: 2906 From: bradodarb Date: 1/2/2012
Subject: Re: Connection Management....
Hello Ray,

That is correct.

-Brad Murry
--- In DynoMotion@yahoogroups.com, "himykabibble" <jagboy@...> wrote:
>
> Brad,
>
> So, if I'm understanding correctly.... The Axis and IO setup can be done once, but must be done WHEN connected. But subsequent re-connects can simple download the Init.c, and that's it?
>
> Regards,
> Ray L.
>
> --- In DynoMotion@yahoogroups.com, Brad Murry <bradodarb@> wrote:
> >
> > Hello Ray,
> >
> >
> >
> > I must have been unclear, sorry about that.
> >
> >
> >
> > What I meant was do everything you are doing(monitoring connection, etc.)
> > but when you reach the point of detecting a loss of connection and then a
> > reconnect just call your init files and that's it.
> >
> >
> >
> > -Brad Murry
> >
> >
> >
> > From: DynoMotion@yahoogroups.com [mailto:DynoMotion@yahoogroups.com] On
> > Behalf Of himykabibble
> > Sent: Monday, January 02, 2012 9:21 PM
> > To: DynoMotion@yahoogroups.com
> > Subject: [DynoMotion] Re: Connection Management....
> >
> >
> >
> >
> >
> > Brad,
> >
> > If I try to do a full init with no board connected, I get tons of exceptions
> > when doing the axis and IO setup, which is why it seemed to me I HAD to have
> > the board present to do that.
> >
> > Regards,
> > Ray L.
> >
> > --- In DynoMotion@yahoogroups.com <mailto:DynoMotion%40yahoogroups.com> ,
> > "bradodarb" <bradodarb@> wrote:
> > >
> > > Hello Ray,
> > >
> > > I would just call the init on reconnect, there should no need to reinit
> > everything.
> > >
> > > -Brad Murry
> > >
> > > --- In DynoMotion@yahoogroups.com <mailto:DynoMotion%40yahoogroups.com> ,
> > "himykabibble" <jagboy@> wrote:
> > > >
> > > > I'm finding connection management rather bothersome. I've modified my
> > constructor so it creates the KM_Controller object, then, every 100 mSec I
> > call a method that compares the current Connected state to the previous (100
> > mSec ago). If it WAS disconnected, and IS now connected, then I re-initalize
> > everything (creating new Axis and IO dictionaries), then download my Init.c.
> > But, I'm finding I get frequent errors when the board comes or goes.
> > Sometimes I'll get an error from a ReadDigitalIO call, complaining about a
> > null reference, or an exception from within KMIO due to an invalid return
> > value. And, of course, I've had to litter my code with "if
> > (KMController.Connected)", so I don't try to talk to a board that isn't
> > there.
> > > >
> > > > Can I get some pointers on how to correctly handle this, so I handle
> > connection state changes cleanly?
> > > >
> > > > Regards,
> > > > Ray L.
> > > >
> > >
> >
>
Group: DynoMotion Message: 2907 From: himykabibble Date: 1/2/2012
Subject: Re: Connection Management....
Brad,

OK, that appears to be working. However, with the Dispose call in the OnClosing event, and no board plugged in, KM_Controller.Dispose is throwing an un-handled exception exception when I close my window.

I'm also frequent exception from GetDigitalValue when the connection state changes. Since I have all of my calls to ANY KM_Controller methods surrounded with a test to ensure the board is connected, AND my init download has completed, this suggests there is some time required AFTER doing the init download before the board is really ready to run. How do I determine it's really and truly fully up and running?

Regards,
Ray L.

--- In DynoMotion@yahoogroups.com, "bradodarb" <bradodarb@...> wrote:
>
> Hello Ray,
>
> That is correct.
>
> -Brad Murry
> --- In DynoMotion@yahoogroups.com, "himykabibble" <jagboy@> wrote:
> >
> > Brad,
> >
> > So, if I'm understanding correctly.... The Axis and IO setup can be done once, but must be done WHEN connected. But subsequent re-connects can simple download the Init.c, and that's it?
> >
> > Regards,
> > Ray L.
> >
> > --- In DynoMotion@yahoogroups.com, Brad Murry <bradodarb@> wrote:
> > >
> > > Hello Ray,
> > >
> > >
> > >
> > > I must have been unclear, sorry about that.
> > >
> > >
> > >
> > > What I meant was do everything you are doing(monitoring connection, etc.)
> > > but when you reach the point of detecting a loss of connection and then a
> > > reconnect just call your init files and that's it.
> > >
> > >
> > >
> > > -Brad Murry
> > >
> > >
> > >
> > > From: DynoMotion@yahoogroups.com [mailto:DynoMotion@yahoogroups.com] On
> > > Behalf Of himykabibble
> > > Sent: Monday, January 02, 2012 9:21 PM
> > > To: DynoMotion@yahoogroups.com
> > > Subject: [DynoMotion] Re: Connection Management....
> > >
> > >
> > >
> > >
> > >
> > > Brad,
> > >
> > > If I try to do a full init with no board connected, I get tons of exceptions
> > > when doing the axis and IO setup, which is why it seemed to me I HAD to have
> > > the board present to do that.
> > >
> > > Regards,
> > > Ray L.
> > >
> > > --- In DynoMotion@yahoogroups.com <mailto:DynoMotion%40yahoogroups.com> ,
> > > "bradodarb" <bradodarb@> wrote:
> > > >
> > > > Hello Ray,
> > > >
> > > > I would just call the init on reconnect, there should no need to reinit
> > > everything.
> > > >
> > > > -Brad Murry
> > > >
> > > > --- In DynoMotion@yahoogroups.com <mailto:DynoMotion%40yahoogroups.com> ,
> > > "himykabibble" <jagboy@> wrote:
> > > > >
> > > > > I'm finding connection management rather bothersome. I've modified my
> > > constructor so it creates the KM_Controller object, then, every 100 mSec I
> > > call a method that compares the current Connected state to the previous (100
> > > mSec ago). If it WAS disconnected, and IS now connected, then I re-initalize
> > > everything (creating new Axis and IO dictionaries), then download my Init.c.
> > > But, I'm finding I get frequent errors when the board comes or goes.
> > > Sometimes I'll get an error from a ReadDigitalIO call, complaining about a
> > > null reference, or an exception from within KMIO due to an invalid return
> > > value. And, of course, I've had to litter my code with "if
> > > (KMController.Connected)", so I don't try to talk to a board that isn't
> > > there.
> > > > >
> > > > > Can I get some pointers on how to correctly handle this, so I handle
> > > connection state changes cleanly?
> > > > >
> > > > > Regards,
> > > > > Ray L.
> > > > >
> > > >
> > >
> >
>
Group: DynoMotion Message: 2909 From: Tom Kerekes Date: 1/2/2012
Subject: Re: Connection Management....
Hi Ray,
 
The board should accept commands before during and immediately after the init download so I doubt if that is the issue.
 
When does it happen on connect or disconnect.  Seems like a disconnect is a possibility if you are just getting status every 100ms and that is setting the connected/disconnected state then if the disconnect happens mid way between status checks and then something decides to do a GetDigitalValue after the disconnect but before the next status the it would fail.
 
Regards
TK 

Group: DynoMotion Message: 2911 From: Brad Murry Date: 1/2/2012
Subject: Re: Connection Management....

Hello Ray,

 

On the exception while exiting, this may help::

 

In your Form OnClosing()

 

First)

Stop your timer

 

Second)

Dispose of the controller

 

 

I suspect you are disposing the controller and the timer is still chugging along and eventually encounters a disposed KM_Controller object.

 

-Brad Murry

 

From: DynoMotion@yahoogroups.com [mailto:DynoMotion@yahoogroups.com] On Behalf Of himykabibble
Sent: Monday, January 02, 2012 10:31 PM
To: DynoMotion@yahoogroups.com
Subject: [DynoMotion] Re: Connection Management....

 

 

Brad,

OK, that appears to be working. However, with the Dispose call in the OnClosing event, and no board plugged in, KM_Controller.Dispose is throwing an un-handled exception exception when I close my window.

I'm also frequent exception from GetDigitalValue when the connection state changes. Since I have all of my calls to ANY KM_Controller methods surrounded with a test to ensure the board is connected, AND my init download has completed, this suggests there is some time required AFTER doing the init download before the board is really ready to run. How do I determine it's really and truly fully up and running?

Regards,
Ray L.

--- In DynoMotion@yahoogroups.com, "bradodarb" <bradodarb@...> wrote:
>
> Hello Ray,
>
> That is correct.
>
> -Brad Murry
> --- In DynoMotion@yahoogroups.com, "himykabibble" <jagboy@> wrote:
> >
> > Brad,
> >
> > So, if I'm understanding correctly.... The Axis and IO setup can be done once, but must be done WHEN connected. But subsequent re-connects can simple download the Init.c, and that's it?
> >
> > Regards,
> > Ray L.
> >
> > --- In DynoMotion@yahoogroups.com, Brad Murry <bradodarb@> wrote:
> > >
> > > Hello Ray,
> > >
> > >
> > >
> > > I must have been unclear, sorry about that.
> > >
> > >
> > >
> > > What I meant was do everything you are doing(monitoring connection, etc.)
> > > but when you reach the point of detecting a loss of connection and then a
> > > reconnect just call your init files and that's it.
> > >
> > >
> > >
> > > -Brad Murry
> > >
> > >
> > >
> > > From: DynoMotion@yahoogroups.com [mailto:DynoMotion@yahoogroups.com] On
> > > Behalf Of himykabibble
> > > Sent: Monday, January 02, 2012 9:21 PM
> > > To: DynoMotion@yahoogroups.com
> > > Subject: [DynoMotion] Re: Connection Management....
> > >
> > >
> > >
> > >
> > >
> > > Brad,
> > >
> > > If I try to do a full init with no board connected, I get tons of exceptions
> > > when doing the axis and IO setup, which is why it seemed to me I HAD to have
> > > the board present to do that.
> > >
> > > Regards,
> > > Ray L.
> > >
> > > --- In DynoMotion@yahoogroups.com <mailto:DynoMotion%40yahoogroups.com> ,
> > > "bradodarb" <bradodarb@> wrote:
> > > >
> > > > Hello Ray,
> > > >
> > > > I would just call the init on reconnect, there should no need to reinit
> > > everything.
> > > >
> > > > -Brad Murry
> > > >
> > > > --- In DynoMotion@yahoogroups.com <mailto:DynoMotion%40yahoogroups.com> ,
> > > "himykabibble" <jagboy@> wrote:
> > > > >
> > > > > I'm finding connection management rather bothersome. I've modified my
> > > constructor so it creates the KM_Controller object, then, every 100 mSec I
> > > call a method that compares the current Connected state to the previous (100
> > > mSec ago). If it WAS disconnected, and IS now connected, then I re-initalize
> > > everything (creating new Axis and IO dictionaries), then download my Init.c.
> > > But, I'm finding I get frequent errors when the board comes or goes.
> > > Sometimes I'll get an error from a ReadDigitalIO call, complaining about a
> > > null reference, or an exception from within KMIO due to an invalid return
> > > value. And, of course, I've had to litter my code with "if
> > > (KMController.Connected)", so I don't try to talk to a board that isn't
> > > there.
> > > > >
> > > > > Can I get some pointers on how to correctly handle this, so I handle
> > > connection state changes cleanly?
> > > > >
> > > > > Regards,
> > > > > Ray L.
> > > > >
> > > >
> > >
> >
>

Group: DynoMotion Message: 2914 From: himykabibble Date: 1/2/2012
Subject: Re: Connection Management....
Tom,

Oddly, it seems to happen most persistently on a re-connect. I can see there is still going to be a problem on asynchronous disconnects. I'm not currently trapping any exceptions, so I still need to put a bunch of try/catch's in.

Regards,
Ray L.

--- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@...> wrote:
>
> Hi Ray,
>  
> The board should accept commands before during and immediately after the init download so I doubt if that is the issue.
>  
> When does it happen on connect or disconnect.  Seems like a disconnect is a possibility if you are just getting status every 100ms and that is setting the connected/disconnected state then if the disconnect happens mid way between status checks and then something decides to do a GetDigitalValue after the disconnect but before the next status the it would fail.
>  
> Regards
> TK 
>
> From: himykabibble <jagboy@...>
> To: DynoMotion@yahoogroups.com
> Sent: Monday, January 2, 2012 9:31 PM
> Subject: [DynoMotion] Re: Connection Management....
>
>
>  
> Brad,
>
> OK, that appears to be working. However, with the Dispose call in the OnClosing event, and no board plugged in, KM_Controller.Dispose is throwing an un-handled exception exception when I close my window.
>
> I'm also frequent exception from GetDigitalValue when the connection state changes. Since I have all of my calls to ANY KM_Controller methods surrounded with a test to ensure the board is connected, AND my init download has completed, this suggests there is some time required AFTER doing the init download before the board is really ready to run. How do I determine it's really and truly fully up and running?
>
> Regards,
> Ray L.
>
> --- In DynoMotion@yahoogroups.com, "bradodarb" <bradodarb@> wrote:
> >
> > Hello Ray,
> >
> > That is correct.
> >
> > -Brad Murry
> > --- In DynoMotion@yahoogroups.com, "himykabibble" <jagboy@> wrote:
> > >
> > > Brad,
> > >
> > > So, if I'm understanding correctly.... The Axis and IO setup can be done once, but must be done WHEN connected. But subsequent re-connects can simple download the Init.c, and that's it?
> > >
> > > Regards,
> > > Ray L.
> > >
> > > --- In DynoMotion@yahoogroups.com, Brad Murry <bradodarb@> wrote:
> > > >
> > > > Hello Ray,
> > > >
> > > >
> > > >
> > > > I must have been unclear, sorry about that.
> > > >
> > > >
> > > >
> > > > What I meant was do everything you are doing(monitoring connection, etc.)
> > > > but when you reach the point of detecting a loss of connection and then a
> > > > reconnect just call your init files and that's it.
> > > >
> > > >
> > > >
> > > > -Brad Murry
> > > >
> > > >
> > > >
> > > > From: DynoMotion@yahoogroups.com [mailto:DynoMotion@yahoogroups.com] On
> > > > Behalf Of himykabibble
> > > > Sent: Monday, January 02, 2012 9:21 PM
> > > > To: DynoMotion@yahoogroups.com
> > > > Subject: [DynoMotion] Re: Connection Management....
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > Brad,
> > > >
> > > > If I try to do a full init with no board connected, I get tons of exceptions
> > > > when doing the axis and IO setup, which is why it seemed to me I HAD to have
> > > > the board present to do that.
> > > >
> > > > Regards,
> > > > Ray L.
> > > >
> > > > --- In DynoMotion@yahoogroups.com <mailto:DynoMotion%40yahoogroups.com> ,
> > > > "bradodarb" <bradodarb@> wrote:
> > > > >
> > > > > Hello Ray,
> > > > >
> > > > > I would just call the init on reconnect, there should no need to reinit
> > > > everything.
> > > > >
> > > > > -Brad Murry
> > > > >
> > > > > --- In DynoMotion@yahoogroups.com <mailto:DynoMotion%40yahoogroups.com> ,
> > > > "himykabibble" <jagboy@> wrote:
> > > > > >
> > > > > > I'm finding connection management rather bothersome. I've modified my
> > > > constructor so it creates the KM_Controller object, then, every 100 mSec I
> > > > call a method that compares the current Connected state to the previous (100
> > > > mSec ago). If it WAS disconnected, and IS now connected, then I re-initalize
> > > > everything (creating new Axis and IO dictionaries), then download my Init.c.
> > > > But, I'm finding I get frequent errors when the board comes or goes.
> > > > Sometimes I'll get an error from a ReadDigitalIO call, complaining about a
> > > > null reference, or an exception from within KMIO due to an invalid return
> > > > value. And, of course, I've had to litter my code with "if
> > > > (KMController.Connected)", so I don't try to talk to a board that isn't
> > > > there.
> > > > > >
> > > > > > Can I get some pointers on how to correctly handle this, so I handle
> > > > connection state changes cleanly?
> > > > > >
> > > > > > Regards,
> > > > > > Ray L.
> > > > > >
> > > > >
> > > >
> > >
> >
>
Group: DynoMotion Message: 2915 From: himykabibble Date: 1/2/2012
Subject: Re: Connection Management....
Brad,

Nope, that's what I was already doing. I now have a flag that tells me the one-time init (defining axes, I/Os, etc.) has been done, and if that flag is not set, I just don't call KM_Controller.Dispose(). The one-time init is done as soon as I see Connected go true after the app starts. That all seems to be working OK now. But I'm still getting frequent exceptions coming from GetDigitalValue on disconnects and re-connects.

Regards,
Ray L.

--- In DynoMotion@yahoogroups.com, Brad Murry <bradodarb@...> wrote:
>
> Hello Ray,
>
>
>
> On the exception while exiting, this may help::
>
>
>
> In your Form OnClosing()
>
>
>
> First)
>
> Stop your timer
>
>
>
> Second)
>
> Dispose of the controller
>
>
>
>
>
> I suspect you are disposing the controller and the timer is still chugging
> along and eventually encounters a disposed KM_Controller object.
>
>
>
> -Brad Murry
>
>
>
> From: DynoMotion@yahoogroups.com [mailto:DynoMotion@yahoogroups.com] On
> Behalf Of himykabibble
> Sent: Monday, January 02, 2012 10:31 PM
> To: DynoMotion@yahoogroups.com
> Subject: [DynoMotion] Re: Connection Management....
>
>
>
>
>
> Brad,
>
> OK, that appears to be working. However, with the Dispose call in the
> OnClosing event, and no board plugged in, KM_Controller.Dispose is throwing
> an un-handled exception exception when I close my window.
>
> I'm also frequent exception from GetDigitalValue when the connection state
> changes. Since I have all of my calls to ANY KM_Controller methods
> surrounded with a test to ensure the board is connected, AND my init
> download has completed, this suggests there is some time required AFTER
> doing the init download before the board is really ready to run. How do I
> determine it's really and truly fully up and running?
>
> Regards,
> Ray L.
>
> --- In DynoMotion@yahoogroups.com <mailto:DynoMotion%40yahoogroups.com> ,
> "bradodarb" <bradodarb@> wrote:
> >
> > Hello Ray,
> >
> > That is correct.
> >
> > -Brad Murry
> > --- In DynoMotion@yahoogroups.com <mailto:DynoMotion%40yahoogroups.com> ,
> "himykabibble" <jagboy@> wrote:
> > >
> > > Brad,
> > >
> > > So, if I'm understanding correctly.... The Axis and IO setup can be done
> once, but must be done WHEN connected. But subsequent re-connects can simple
> download the Init.c, and that's it?
> > >
> > > Regards,
> > > Ray L.
> > >
> > > --- In DynoMotion@yahoogroups.com <mailto:DynoMotion%40yahoogroups.com>
> , Brad Murry <bradodarb@> wrote:
> > > >
> > > > Hello Ray,
> > > >
> > > >
> > > >
> > > > I must have been unclear, sorry about that.
> > > >
> > > >
> > > >
> > > > What I meant was do everything you are doing(monitoring connection,
> etc.)
> > > > but when you reach the point of detecting a loss of connection and
> then a
> > > > reconnect just call your init files and that's it.
> > > >
> > > >
> > > >
> > > > -Brad Murry
> > > >
> > > >
> > > >
> > > > From: DynoMotion@yahoogroups.com <mailto:DynoMotion%40yahoogroups.com>
> [mailto:DynoMotion@yahoogroups.com <mailto:DynoMotion%40yahoogroups.com> ]
> On
> > > > Behalf Of himykabibble
> > > > Sent: Monday, January 02, 2012 9:21 PM
> > > > To: DynoMotion@yahoogroups.com <mailto:DynoMotion%40yahoogroups.com>
> > > > Subject: [DynoMotion] Re: Connection Management....
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > Brad,
> > > >
> > > > If I try to do a full init with no board connected, I get tons of
> exceptions
> > > > when doing the axis and IO setup, which is why it seemed to me I HAD
> to have
> > > > the board present to do that.
> > > >
> > > > Regards,
> > > > Ray L.
> > > >
> > > > --- In DynoMotion@yahoogroups.com
> <mailto:DynoMotion%40yahoogroups.com> <mailto:DynoMotion%40yahoogroups.com>
> ,
> > > > "bradodarb" <bradodarb@> wrote:
> > > > >
> > > > > Hello Ray,
> > > > >
> > > > > I would just call the init on reconnect, there should no need to
> reinit
> > > > everything.
> > > > >
> > > > > -Brad Murry
> > > > >
> > > > > --- In DynoMotion@yahoogroups.com
> <mailto:DynoMotion%40yahoogroups.com> <mailto:DynoMotion%40yahoogroups.com>
> ,
> > > > "himykabibble" <jagboy@> wrote:
> > > > > >
> > > > > > I'm finding connection management rather bothersome. I've modified
> my
> > > > constructor so it creates the KM_Controller object, then, every 100
> mSec I
> > > > call a method that compares the current Connected state to the
> previous (100
> > > > mSec ago). If it WAS disconnected, and IS now connected, then I
> re-initalize
> > > > everything (creating new Axis and IO dictionaries), then download my
> Init.c.
> > > > But, I'm finding I get frequent errors when the board comes or goes.
> > > > Sometimes I'll get an error from a ReadDigitalIO call, complaining
> about a
> > > > null reference, or an exception from within KMIO due to an invalid
> return
> > > > value. And, of course, I've had to litter my code with "if
> > > > (KMController.Connected)", so I don't try to talk to a board that
> isn't
> > > > there.
> > > > > >
> > > > > > Can I get some pointers on how to correctly handle this, so I
> handle
> > > > connection state changes cleanly?
> > > > > >
> > > > > > Regards,
> > > > > > Ray L.
> > > > > >
> > > > >
> > > >
> > >
> >
>